﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ECatalog.Models;
using ECatalog.Models.UserModel;

namespace ECatalog.Controllers
{
    public class StatModelController : Controller
    {
        private DbContainer db = new DbContainer();
        private readonly IUserRepository userRepository;

        public StatModelController(IUserRepository userRepository)
        {
            this.userRepository = userRepository;
        }

        public ActionResult Index()
        {
            @ViewBag.IsAdmin = userRepository.IsAdmin(User.Identity.Name);
            return View(db.StatModels.ToList());
        }
        
        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}